/**
 * 卡片显示checkbox组件
 */
var React = require("react");
var {Util} = require("flower");
var {Checkbox} = require("react-icheck");
class ShowCheckbox extends React.Component{

    constructor(props){
        super(props);
        this.state = {
            checked:this.props.defaultValue
        };
    }

    componentDidMount(){

    }

    handleChange(e,checked){
        this.setCheck(checked);
        if(this.props._handleChange){
            this.props._handleChange(this.props.rowId,checked);
        }
    }

    setCheck(b){
        this.refs.show.setChecked(b);
    }

    render(){
        return <Checkbox ref="show"
            checkboxClass="icheckbox_square-blue"
            increaseArea="20%"
            defaultChecked={this.state.checked}
            onChange={this.handleChange.bind(this)}
        />
    }
}
module.exports = ShowCheckbox;